﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using MVC4WPF;

namespace $rootnamespace$
{
    /// <summary>
    /// Interaction logic for $safeitemname$
    /// </summary>
    public partial class $safeitemname$ : $BaseType$, $ViewContractName$
    {
        #region Constructor

        /// <summary>
        /// Constructor for the $safeitemname$ $ControlTypeName$
        public $safeitemname$()
        {
            InitializeComponent();
        }

        #endregion$if$ ($ViewType$ == ViewWindow)

        #region Window Close Logic

        protected override void WPFViewWindow_Closing(object sender, CancelEventArgs e)
        {
            //Calling the base closing handler. 
            //This will alert and subcribers that the window is closing.
            base.WPFViewWindow_Closing(sender, e);

            //Confirming that the window should be closed
            if (!e.Cancel)
            {
                try
                {
                    //Releasing the WPFViewWindow base class resources.
                    ReleaseViewWindowResources();

                    //Release the view contract resources.
                    ReleaseContractResources();
                }
                catch
                {
                    //Swallowing the exception this is a destruction cycle so this exception should not be raised.
                }
            }
        }

        #endregion$endif$
    }
}
